Help > Reference > Macros > Document object > Line property

Line property

This property returns the specified document line.

Member of

Document

Type

Read-Only String(Index) Property

As a way to retrieve data very quickly, Perceptive Search artificially formats documents into lines and pages while indexing. By default, Perceptive Search will wrap lines at 76 characters if they do not have soft returns. You can declare a larger notional right margin in ISYS.CFG by use of the WIDELINES indexing option (enforces a 200 character wrap) or WIDEMEANS option if you wish to set an arbitrary right margin.

You may access document lines in any order. Perceptive Search maintains its own internal cache and can navigate randomly with great efficiency.

Within the returned string Perceptive Search may include special character codes to indicate formating. These include font styles (underline, italic, bold) and "hit":

A soft space is used to pad words when fully justifying text with a monospaced font or when expanding tabs.

A special case is character code 6, which indicates the start of a "hit". It is immediately followed by another character which represents the term id of the word found. Term ids are numbered starting from 48, which for convenience is the code for the visible character "0". The "hit" ends with a character code 2.

For example, if you searched for "cat or dog" and if appropriate synonyms were in effect, you might see contents such as:

#6 #48 CAT #2 ... #6 #49 DOG #2 ... #6 #48 FELINE #2

Another special case is entity recognition, if enabled. When an entity appears in the document content, it is prefixed by a character code 17, which is immediately followed by a four character entity ID. Then the normal text of the entity follows as it would normally appear. Finally, the extent of the entity is terminated by a character code 18. For example:

THE SENDER WAS #17 AAAA MR SMITH #18 ON TUESDAY

If you wish to simply display the text, ignoring the Perceptive Search formatting, you need to remove from the text all characters with code less than or equal to 18, remove the character immediately following character code 6 and the four characters that follow character code 17.

The example below will display the first line of the first document in the search results of the active tab. The code will also process the Perceptive Search formatting, if included in the text.

Example

DocumentLine = App.ActiveTab.Item(0).Line(0)
DisplayText = ""
mark_started = False
CharNo = 1
While CharNo <= Len(DocumentLine)
  Select Case Asc(Mid(DocumentLine, CharNo, 1))
    Case 1 ' Soft space
      DisplayText = DisplayText & " "
    Case 2 ' Start normal style
      If mark_started Then
        DisplayText = DisplayText & "]"
        mark_started = False
      End If
    Case 3 ' Start bold style
      DisplayText = DisplayText & "[B "
      mark_started = True
    Case 4 ' Start italic style
      DisplayText = DisplayText & "[I "
      mark_started = True
    Case 5 ' Start underline style
      DisplayText = DisplayText & "[U "
      mark_started = True
    Case 6 ' Start "hit" style
      DisplayText = DisplayText & "[H "
      mark_started = True
      CharNo = CharNo + 1 ' skip the search term identifier
    Case 14 ' New paragraph marker
      DisplayText = DisplayText & "[P]"
    Case 17 ' Entity starts
      DisplayText = DisplayText & "[E:" & Mid(DocumentLine, CharNo + 1, 4) & " "
      CharNo = CharNo + 4
    Case 18 ' Entity ends
      DisplayText = DisplayText & "]"
    Case Else
      DisplayText = DisplayText &  Mid(DocumentLine, CharNo, 1)
  End Select
  CharNo = CharNo + 1
Wend
MsgBox DisplayText

' Suppose you search was for "Tuesday" and the line returned was:
'   The #3 sender #2 was #17 AAAA Mr Smith #18 on #6 #48 Tuesday #2
' After processing the special characters in the code above, the line will be:
'   The [B sender] was [E:AAAA Mr Smith] on [H Tuesday]

See Also

Macro Object Model

Document